package org.juc;

public class Test {

    volatile int a,b,x,y;

    public static void main(String[] args) {
        Test test=new Test();
        test.demo();

    }

    public void demo(){
        new Thread(() ->{
            x=a;
            b=1;
        },"Thread1").start();
        new Thread(() ->{
            y=b;
            a=2;
        },"Thread2").start();

        System.out.println("a = "+a+" b = "+b+" x = "+x+" y = "+y);
    }

}
